package com.zb.sannuo.thereport.service.impl;

import com.baomidou.mybatisplus.extension.api.R;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zb.sannuo.common.domain.search.JCFrequency;
import com.zb.sannuo.common.domain.vo.ReportVo;
import com.zb.sannuo.thereport.mapper.XfzDataMapper;
import com.zb.sannuo.thereport.service.XfzDataService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class XfzDataServiceImpl implements XfzDataService {

    @Resource
    private XfzDataMapper xfzDataMapper;

    @Override
    public List<JCFrequency> findXfzData(ReportVo reportVo) {
        return xfzDataMapper.findXfzData(reportVo);
    }

    @Override
    public List<JCFrequency> findJgFx(String searchParams) {
        ObjectMapper mapper = new ObjectMapper();
        ReportVo reportVo = null;
        if (searchParams!=null && !"".equals(searchParams)){
            try {
                reportVo = mapper.readValue(searchParams, ReportVo.class);
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }
        }
        return xfzDataMapper.findJgFx(reportVo);
    }


}
